﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PartTree.aspx.cs" Inherits="Besture.UI.Admin.Common.ArticleClassTree" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" href="/Admin/PlugIn/ZTree/css/zTreeStyle/zTreeStyle.css" type="text/css" />
    <script type="text/javascript" src="/Admin/PlugIn/ZTree/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="/Admin/PlugIn/ZTree/js/jquery.ztree.core-3.5.js"></script>
    <script type="text/javascript">
		<!--
        var setting = {
			data: {
				simpleData: {
					enable: true
				}
			}
		};

        var zNodes = <%=_json %>;

        $(document).ready(function () {
            $.fn.zTree.init($("#treeDemo"), setting, zNodes);
        });
		//-->
        
    	var api = frameElement.api, W = api.opener;

    	api.button({
    	    id: 'valueOk',
    	    name: '确定',
    	    callback: ok
    	});

    	function ok() {
    	    var zTree = $.fn.zTree.getZTreeObj("treeDemo");
    	    var nodes = zTree.getSelectedNodes();
    	    if (nodes.length == 0) {
    	        alert("请选择上级类别");
    	        return false;
    	    }
    	    W.jQuery(".common_Article_class_tree_parentname").val(nodes[0].name);
    	    W.jQuery(".common_Article_class_tree_parentid").val(nodes[0].id);
    	    //栏目类型值
    	    if(W.jQuery("#hidTypeID").val()=="0") {
    	        W.RadioClick(nodes[0].typeid);
    	    }
    	}
    	
        //选中默认节点
        function DefaultSelectNodes() {
            var classID = "<%=_SelectClassID %>";
            var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
            var node = treeObj.getNodeByParam("id",classID,null);
            treeObj.selectNode(node);
        }
        
        $(function() {
    	    DefaultSelectNodes();
    	});
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="content_wrap">
        <div class="zTreeDemoBackground left">
            <ul id="treeDemo" class="ztree">
            </ul>
        </div>
    </div>
    </form>
</body>
</html>
